```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS 设计与实践 - 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #2d3748;
            line-height: 1.6;
        }
        h1, h2, h3, h4, h5, h6 {
            font-family: 'Noto Serif SC', serif;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
        }
        .selector-card {
            border-left: 4px solid #667eea;
        }
        .highlight-box {
            position: relative;
        }
        .highlight-box::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 4px;
            height: 100%;
            background: linear-gradient(to bottom, #667eea, #764ba2);
        }
        .mermaid {
            background: rgba(255,255,255,0.9);
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <div class="hero-gradient text-white py-20 px-4 sm:px-6 lg:px-8">
        <div class="max-w-7xl mx-auto">
            <div class="text-center">
                <h1 class="text-4xl md:text-5xl font-bold mb-6">CSS 设计与实践</h1>
                <p class="text-xl md:text-2xl max-w-3xl mx-auto mb-8">
                    探索层叠样式表的艺术与科学，打造视觉惊艳的现代网页
                </p>
                <div class="flex justify-center space-x-4">
                    <a href="#overview" class="px-6 py-3 bg-white text-indigo-700 font-medium rounded-lg hover:bg-gray-100 transition duration-300">
                        <i class="fas fa-book-open mr-2"></i>开始学习
                    </a>
                    <a href="#selectors" class="px-6 py-3 bg-indigo-700 bg-opacity-20 text-white font-medium rounded-lg hover:bg-opacity-30 transition duration-300">
                        <i class="fas fa-code mr-2"></i>查看选择器
                    </a>
                </div>
            </div>
        </div>
    </div>

    <!-- Main Content -->
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
        <!-- CSS Overview -->
        <section id="overview" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-8 h-8 bg-indigo-600 rounded-full flex items-center justify-center text-white mr-4">
                    <i class="fas fa-info-circle"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">CSS 概述</h2>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8 card-hover">
                <div class="p-8">
                    <div class="highlight-box pl-6 mb-6">
                        <p class="text-lg leading-relaxed mb-2"><i class="fas fa-check-circle text-indigo-500 mr-2"></i> CSS 指层叠样式表 (Cascading Style Sheets)</p>
                        <p class="text-lg leading-relaxed mb-2"><i class="fas fa-check-circle text-indigo-500 mr-2"></i> 样式定义如何显示 HTML 元素</p>
                        <p class="text-lg leading-relaxed mb-2"><i class="fas fa-check-circle text-red-500 mr-2"></i> 是为了解决内容与表现分离的问题</p>
                        <p class="text-lg leading-relaxed mb-2"><i class="fas fa-check-circle text-indigo-500 mr-2"></i> 多个样式定义可层叠为一</p>
                        <p class="text-lg leading-relaxed"><i class="fas fa-check-circle text-indigo-500 mr-2"></i> 样式通常存储在样式表中</p>
                    </div>
                    
                    <div class="mt-8">
                        <div class="mermaid">
                            graph TD
                                A[HTML 结构] --> B[内容与表现分离]
                                B --> C[CSS 样式表]
                                C --> D[更易维护]
                                C --> E[更灵活的设计]
                                C --> F[更好的可访问性]
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Selectors Section -->
        <section id="selectors" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-8 h-8 bg-indigo-600 rounded-full flex items-center justify-center text-white mr-4">
                    <i class="fas fa-mouse-pointer"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">选择器</h2>
            </div>
            <p class="text-xl text-gray-600 mb-8">选择器用于选择你需要修饰的 HTML 元素</p>
            
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                <!-- 通配符选择器 -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover selector-card">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="w-10 h-10 bg-purple-100 rounded-full flex items-center justify-center text-purple-600 mr-3">
                                <i class="fas fa-asterisk"></i>
                            </div>
                            <h3 class="text-xl font-semibold">通配符选择器</h3>
                        </div>
                        <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787689026-3b4a0e83-36c7-4130-8570-acf704a6feb8.png" alt="通配符选择器" class="w-full rounded-lg mb-4">
                        <p class="text-gray-600">选择所有元素，通常用于重置样式</p>
                    </div>
                </div>
                
                <!-- 标签选择器 -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover selector-card">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="w-10 h-10 bg-blue-100 rounded-full flex items-center justify-center text-blue-600 mr-3">
                                <i class="fas fa-tag"></i>
                            </div>
                            <h3 class="text-xl font-semibold">标签选择器</h3>
                        </div>
                        <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787689290-de0e98fb-81a7-4fb5-9e77-72ad72c2a3a5.png" alt="标签选择器" class="w-full rounded-lg mb-4">
                        <p class="text-gray-600">选择特定类型的 HTML 元素</p>
                    </div>
                </div>
                
                <!-- 类选择器 -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover selector-card">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="w-10 h-10 bg-green-100 rounded-full flex items-center justify-center text-green-600 mr-3">
                                <i class="fas fa-dot-circle"></i>
                            </div>
                            <h3 class="text-xl font-semibold">类选择器</h3>
                        </div>
                        <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787689538-27b543f6-bc28-4477-b9a0-8230970b6dbf.png" alt="类选择器" class="w-full rounded-lg mb-4">
                        <p class="text-gray-600">选择具有特定 class 属性的元素</p>
                    </div>
                </div>
                
                <!-- ID选择器 -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover selector-card">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="w-10 h-10 bg-red-100 rounded-full flex items-center justify-center text-red-600 mr-3">
                                <i class="fas fa-hashtag"></i>
                            </div>
                            <h3 class="text-xl font-semibold">ID选择器</h3>
                        </div>
                        <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787689806-e5386f7b-8c68-42f7-aa52-9c3eb324269e.png" alt="ID选择器" class="w-full rounded-lg mb-4">
                        <p class="text-gray-600">选择具有特定 ID 属性的元素</p>
                        <div class="mt-4 p-4 bg-yellow-50 rounded-lg">
                            <h4 class="font-medium text-gray-800 mb-2">三种基本选择器的优先级</h4>
                            <p class="text-gray-700">ID > CLASS > 标签</p>
                        </div>
                    </div>
                </div>
                
                <!-- 群组选择器 -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover selector-card">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="w-10 h-10 bg-indigo-100 rounded-full flex items-center justify-center text-indigo-600 mr-3">
                                <i class="fas fa-object-group"></i>
                            </div>
                            <h3 class="text-xl font-semibold">群组选择器</h3>
                        </div>
                        <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787690095-25db34a0-7679-4392-81ab-04e90dd7df6d.png" alt="群组选择器" class="w-full rounded-lg mb-4">
                        <p class="text-gray-600">同时选择多个不同类型的元素</p>
                    </div>
                </div>
                
                <!-- 派生选择器 -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover selector-card">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="w-10 h-10 bg-pink-100 rounded-full flex items-center justify-center text-pink-600 mr-3">
                                <i class="fas fa-sitemap"></i>
                            </div>
                            <h3 class="text-xl font-semibold">派生选择器</h3>
                        </div>
                        <p class="text-gray-600 mb-4">通过依据元素在其位置的上下文关系来定义样式</p>
                        
                        <div class="space-y-4">
                            <div class="p-4 bg-gray-50 rounded-lg">
                                <h4 class="font-medium text-gray-800 mb-2">后代选择器</h4>
                                <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787690340-60681d68-7174-4f01-a7d3-00cdba77cf2d.png" alt="后代选择器" class="w-full rounded-lg">
                            </div>
                            
                            <div class="p-4 bg-gray-50 rounded-lg">
                                <h4 class="font-medium text-gray-800 mb-2">子代选择器</h4>
                                <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787690559-e3468f18-7c73-4cbf-b96f-3f31c58785ea.png" alt="子代选择器" class="w-full rounded-lg">
                            </div>
                            
                            <div class="p-4 bg-gray-50 rounded-lg">
                                <h4 class="font-medium text-gray-800 mb-2">相邻兄弟选择器</h4>
                                <div class="space-y-2">
                                    <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787690780-67fe4eb4-6d83-4344-8585-ea27906231dd.png" alt="相邻兄弟选择器1" class="w-full rounded-lg">
                                    <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787691087-d60f4eeb-02fa-4bbd-b116-6b3782ea21d4.png" alt="相邻兄弟选择器2" class="w-full rounded-lg">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Property Selectors Section -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <div class="w-8 h-8 bg-indigo-600 rounded-full flex items-center justify-center text-white mr-4">
                            <i class="fas fa-sliders-h"></i>
                        </div>
                        <h2 class="text-2xl font-bold text-gray-800">属性选择器</h2>
                    </div>
                    
                    <div class="highlight-box pl-6">
                        <p class="text-lg leading-relaxed mb-6">
                            属性选择器可以根据元素的属性及属性值来选择元素。
                        </p>
                        
                        <div class="space-y-4">
                            <div class="bg-gray-50 p-4 rounded-lg">
                                <h4 class="font-medium text-gray-800 mb-2">例子 1</h4>
                                <p class="text-gray-700 mb-2">如果您希望把包含标题（title）的所有元素变为红色，可以写作：</p>
                                <code class="bg-gray-200 px-2 py-1 rounded text-sm">*[title] {color:red;}</code>
                            </div>
                            
                            <div class="bg-gray-50 p-4 rounded-lg">
                                <h4 class="font-medium text-gray-800 mb-2">例子 2</h4>
                                <p class="text-gray-700 mb-2">与上面类似，可以只对有 href 属性的锚（a 元素）应用样式：</p>
                                <code class="bg-gray-200 px-2 py-1 rounded text-sm">a[href] {color:red;}</code>
                            </div>
                            
                            <div class="bg-gray-50 p-4 rounded-lg">
                                <h4 class="font-medium text-gray-800 mb-2">例子 3</h4>
                                <p class="text-gray-700 mb-2">还可以根据多个属性进行选择，只需将属性选择器链接在一起即可。</p>
                                <p class="text-gray-700 mb-2">例如，为了将同时有 href 和 title 属性的 HTML 超链接的文本设置为红色，可以这样写：</p>
                                <code class="bg-gray-200 px-2 py-1 rounded text-sm">a[href][title] {color:red;}</code>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Pseudo-classes Section -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <div class="w-8 h-8 bg-indigo-600 rounded-full flex items-center justify-center text-white mr-4">
                            <i class="fas fa-magic"></i>
                        </div>
                        <h2 class="text-2xl font-bold text-gray-800">伪类</h2>
                    </div>
                    
                    <div class="highlight-box pl-6">
                        <p class="text-lg leading-relaxed mb-6">
                            CSS 伪类用于向某些选择器添加特殊的效果。
                        </p>
                        
                        <div class="mb-8">
                            <h3 class="text-xl font-semibold mb-4">锚伪类</h3>
                            <p class="text-gray-700 mb-4">在支持 CSS 的浏览器中，链接的不同状态都可以不同的方式显示，这些状态包括：活动状态，已被访问状态，未被访问状态，和鼠标悬停状态。</p>
                            
                            <div class="bg-gray-50 p-4 rounded-lg">
                                <div class="space-y-2">
                                    <p><code class="bg-gray-200 px-2 py-1 rounded text-sm">a:link {color: #FF0000}</code> <span class="text-gray-500">/* 未访问的链接 */</span></p>
                                    <p><code class="bg-gray-200 px-2 py-1 rounded text-sm">a:visited {color: #00FF00}</code> <span class="text-gray-500">/* 已访问的链接 */</span></p>
                                    <p><code class="bg-gray-200 px-2 py-1 rounded text-sm">a:hover {color: #FF00FF}</code> <span class="text-gray-500">/* 鼠标移动到链接上 */</span></p>
                                    <p><code class="bg-gray-200 px-2 py-1 rounded text-sm">a:active {color: #0000FF}</code> <span class="text-gray-500">/* 选定的链接 */</span></p>
                                </div>
                                
                                <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787691355-96c9635b-8c6a-4d9f-9912-8c4c0797278b.png" alt="锚伪类示例" class="w-full rounded-lg mt-4">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Specificity Section -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <div class="w-8 h-8 bg-indigo-600 rounded-full flex items-center justify-center text-white mr-4">
                            <i class="fas fa-trophy"></i>
                        </div>
                        <h2 class="text-2xl font-bold text-gray-800">样式的优先级</h2>
                    </div>
                    
                    <div class="highlight-box pl-6">
                        <div class="mermaid">
                            graph LR
                                A[内联样式] -->|最高优先级| B[ID选择器]
                                B --> C[类/属性/伪类选择器]
                                C --> D[标签选择器]
                                D --> E[通配符选择器]
                                E -->|最低优先级| F[继承的样式]
                        </div>
                        
                        <div class="mt-6 grid grid-cols-1 md:grid-cols-3 gap-4">
                            <div class="bg-gray-50 p-4 rounded-lg">
                                <h4 class="font-medium text-gray-800 mb-2">外部样式文件</h4>
                                <p class="text-gray-700">通过 link 标签引入的外部 CSS 文件</p>
                            </div>
                            <div class="bg-gray-50 p-4 rounded-lg">
                                <h4 class="font-medium text-gray-800 mb-2">内部样式</h4>
                                <p class="text-gray-700">在 style 标签内定义的样式</p>
                            </div>
                            <div class="bg-gray-50 p-4 rounded-lg">
                                <h4 class="font-medium text-gray-800 mb-2">行内样式</h4>
                                <p class="text-gray-700">直接在元素上使用 style 属性定义的样式</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Common CSS Properties -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <div class="w-8 h-8 bg-indigo-600 rounded-full flex items-center justify-center text-white mr-4">
                            <i class="fas fa-cog"></i>
                        </div>
                        <h2 class="text-2xl font-bold text-gray-800">常用 CSS 属性</h2>
                    </div>
                    
                    <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
                        <!-- 字体属性 -->
                        <div class="bg-gray-50 p-6 rounded-lg">
                            <div class="flex items-center mb-4">
                                <div class="w-10 h-10 bg-blue-100 rounded-full flex items-center justify-center text-blue-600 mr-3">
                                    <i class="fas fa-font"></i>
                                </div>
                                <h3 class="text-xl font-semibold">字体属性</h3>
                            </div>
                            <ul class="space-y-2">
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-blue-500 mr-2"></i>
                                    <span>font-family</span>
                                </li>
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-blue-500 mr-2"></i>
                                    <span>font-size</span>
                                </li>
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-blue-500 mr-2"></i>
                                    <span>font-style</span>
                                </li>
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-blue-500 mr-2"></i>
                                    <span>font-weight</span>
                                </li>
                            </ul>
                        </div>
                        
                        <!-- 文本属性 -->
                        <div class="bg-gray-50 p-6 rounded-lg">
                            <div class="flex items-center mb-4">
                                <div class="w-10 h-10 bg-green-100 rounded-full flex items-center justify-center text-green-600 mr-3">
                                    <i class="fas fa-align-left"></i>
                                </div>
                                <h3 class="text-xl font-semibold">文本属性</h3>
                            </div>
                            <ul class="space-y-2">
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-green-500 mr-2"></i>
                                    <span>letter-spacing</span>
                                </li>
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-green-500 mr-2"></i>
                                    <span>text-decoration</span>
                                </li>
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-green-500 mr-2"></i>
                                    <span>text-align</span>
                                </li>
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-green-500 mr-2"></i>
                                    <span>text-indent</span>
                                </li>
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-green-500 mr-2"></i>
                                    <span>line-height</span>
                                </li>
                            </ul>
                        </div>
                        
                        <!-- 背景 -->
                        <div class="bg-gray-50 p-6 rounded-lg">
                            <div class="flex items-center mb-4">
                                <div class="w-10 h-10 bg-purple-100 rounded-full flex items-center justify-center text-purple-600 mr-3">
                                    <i class="fas fa-image"></i>
                                </div>
                                <h3 class="text-xl font-semibold">背景</h3>
                            </div>
                            <ul class="space-y-2">
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-purple-500 mr-2"></i>
                                    <span>background-color</span>
                                </li>
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-purple-500 mr-2"></i>
                                    <span>background-image</span>
                                </li>
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-purple-500 mr-2"></i>
                                    <span>background-repeat</span>
                                </li>
                            </ul>
                        </div>
                        
                        <!-- 边框 -->
                        <div class="bg-gray-50 p-6 rounded-lg">
                            <div class="flex items-center mb-4">
                                <div class="w-10 h-10 bg-yellow-100 rounded-full flex items-center justify-center text-yellow-600 mr-3">
                                    <i class="fas fa-square"></i>
                                </div>
                                <h3 class="text-xl font-semibold">边框</h3>
                            </div>
                            <ul class="space-y-2">
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-yellow-500 mr-2"></i>
                                    <span>border-bottom</span>
                                </li>
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-yellow-500 mr-2"></i>
                                    <span>solid (实线)</span>
                                </li>
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-yellow-500 mr-2"></i>
                                    <span>dashed (虚线)</span>
                                </li>
                                <li class="flex items-center">
                                    <i class="fas fa-angle-right text-yellow-500 mr-2"></i>
                                    <span>double (双实线)</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Box Model Section -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <div class="w-8 h-8 bg-indigo-600 rounded-full flex items-center justify-center text-white mr-4">
                            <i class="fas fa-box"></i>
                        </div>
                        <h2 class="text-2xl font-bold text-gray-800">盒子模型</h2>
                    </div>
                    
                    <div class="highlight-box pl-6">
                        <p class="text-lg leading-relaxed mb-6">
                            CSS 框模型 (Box Model) 规定了元素框处理元素内容、内边距、边框 和 外边距 的方式。
                        </p>
                        
                        <div class="flex justify-center mb-6">
                            <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787691604-518cb2c6-bd43-4c71-b788-8460d450cd11.png" alt="盒子模型" class="max-w-full rounded-lg">
                        </div>
                        
                        <div class="space-y-4">
                            <h3 class="text-xl font-semibold">浏览器兼容性</h3>
                            <p class="text-gray-700">
                                一旦为页面设置了恰当的 DTD，大多数浏览器都会按照上面的图示来呈现内容。然而 IE 5 和 6 的呈现却是不正确的。根据 W3C 的规范，元素内容占据的空间是由 width 属性设置的，而内容周围的 padding 和 border 值是另外计算的。不幸的是，IE5.X 和 6 在怪异模式中使用自己的非标准模型。这些浏览器的 width 属性不是内容的宽度，而是内容、内边距和边框的宽度的总和。
                            </p>
                            <p class="text-gray-700">
                                虽然有方法解决这个问题。但是目前最好的解决方案是回避这个问题。也就是，不要给元素添加具有指定宽度的内边距，而是尝试将内边距或外边距添加到元素的父元素和子元素。
                            </p>
                            <div class="p-4 bg-red-50 rounded-lg">
                                <p class="text-red-600 font-medium">为了兼容IE老版本，一句话，能用外边距就用外边距</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Positioning Section -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <div class="w-8 h-8 bg-indigo-600 rounded-full flex items-center justify-center text-white mr-4">
                            <i class="fas fa-location-arrow"></i>
                        </div>
                        <h2 class="text-2xl font-bold text-gray-800">定位</h2>
                    </div>
                    
                    <div class="highlight-box pl-6">
                        <p class="text-lg leading-relaxed mb-6">
                            CSS 定位 (Positioning) 属性允许你对元素进行定位。定位的基本思想很简单，它允许你定义元素框相对于其正常位置应该出现的位置，或者相对于父元素、另一个元素甚至浏览器窗口本身的位置。
                        </p>
                        
                        <h3 class="text-xl font-semibold mb-4">CSS 定位机制</h3>
                        <p class="text-gray-700 mb-4">
                            CSS 有三种基本的定位机制：普通流、浮动和绝对定位。除非专门指定，否则所有框都在普通流中定位。也就是说，普通流中的元素的位置由元素在 (X)HTML 中的位置决定。块级框从上到下一个接一个地排列，框之间的垂直距离是由框的垂直外边距计算出来。
                        </p>
                        
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mt-8">
                            <!-- 相对定位 -->
                            <div class="bg-gray-50 p-6 rounded-lg">
                                <div class="flex items-center mb-4">
                                    <div class="w-10 h-10 bg-blue-100 rounded-full flex items-center justify-center text-blue-600 mr-3">
                                        <i class="fas fa-arrows-alt"></i>
                                    </div>
                                    <h3 class="text-xl font-semibold">相对定位</h3>
                                </div>
                                <p class="text-gray-700 mb-4">
                                    相对定位：相对于原有的位置发生改变，并且保留原有的空间位置。
                                </p>
                                <div class="bg-white p-4 rounded-lg overflow-x-auto">
                                    <pre><code>&lt;html&gt;
&lt;head&gt;
&lt;style type="text/css"&gt;
h2.pos_left
{
position:relative;
left:-20px
}
h2.pos_right
{
position:relative;
left:20px
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;h2&gt;这是位于正常位置的标题&lt;/h2&gt;
&lt;h2 class="pos_left"&gt;这个标题相对于其正常位置向左移动&lt;/h2&gt;
&lt;h2 class="pos_right"&gt;这个标题相对于其正常位置向右移动&lt;/h2&gt;
&lt;p&gt;相对定位会按照元素的原始位置对该元素进行移动。&lt;/p&gt;
&lt;p&gt;样式 "left:-20px" 从元素的原始左侧位置减去 20 像素。&lt;/p&gt;
&lt;p&gt;样式 "left:20px" 向元素的原始左侧位置增加 20 像素。&lt;/p&gt;
&lt;/body&gt;

&lt;/html&gt;</code></pre>
                                </div>
                                <div class="mt-4 space-y-2">
                                    <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787691864-c0fff51c-9c86-4a14-be29-caca0ab157f8.png" alt="相对定位1" class="w-full rounded-lg">
                                    <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787692097-07a58d83-9d4a-4d3c-9ec7-76b59ea62239.png" alt="相对定位2" class="w-full rounded-lg">
                                </div>
                            </div>
                            
                            <!-- 绝对定位 -->
                            <div class="bg-gray-50 p-6 rounded-lg">
                                <div class="flex items-center mb-4">
                                    <div class="w-10 h-10 bg-red-100 rounded-full flex items-center justify-center text-red-600 mr-3">
                                        <i class="fas fa-bullseye"></i>
                                    </div>
                                    <h3 class="text-xl font-semibold">绝对定位</h3>
                                </div>
                                <p class="text-gray-700 mb-4">
                                    绝对定位相对于他有position属性的父级元素进行定位，如果父级元素没有postion定位，那么就找父级的父级，直到向上找到position定位为止，如果他向上找不到position定位，那么就以最外层的body进行定位。并且绝对定位不会保留原有的位置空间。z-index属性，确定层级大小，用来设定哪一个盒子在上面，越大越在上面
                                </p>
                                <div class="bg-white p-4 rounded-lg overflow-x-auto">
                                    <pre><code>&lt;html&gt;
&lt;head&gt;
&lt;style type="text/css"&gt;
h2.pos_abs
{
position:absolute;
left:100px;
top:150px
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;h2 class="pos_abs"&gt;这是带有绝对定位的标题&lt;/h2&gt;
&lt;p&gt;通过绝对定位，元素可以放置到页面上的任何位置。下面的标题距离页面左侧 100px，距离页面顶部 150px。&lt;/p&gt;
&lt;/body&gt;

&lt;/html&gt;</code></pre>
                                </div>
                                <div class="mt-4 space-y-2">
                                    <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787692330-181e1ad4-a7af-440f-96e9-1e5a98931247.png" alt="绝对定位1" class="w-full rounded-lg">
                                    <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787692529-075500d0-ff8d-4eff-9581-56d00751bfe7.png" alt="绝对定位2" class="w-full rounded-lg">
                                </div>
                                <p class="text-gray-700 mt-4">
                                    如果外层的position属性去掉，那么绝对定位的盒子又会以body为定位
                                </p>
                                <div class="mt-2 space-y-2">
                                    <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787692742-14f20849-a60d-4b26-874b-e045936b01e6.png" alt="绝对定位3" class="w-full rounded-lg">
                                    <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787692948-c222b9e9-ffa1-4e21-a515-24703bcfaa0d.png" alt="绝对定位4" class="w-full rounded-lg">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Floating Section -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <div class="w-8 h-8 bg-indigo-600 rounded-full flex items-center justify-center text-white mr-4">
                            <i class="fas fa-water"></i>
                        </div>
                        <h2 class="text-2xl font-bold text-gray-800">浮动</h2>
                    </div>
                    
                    <div class="highlight-box pl-6">
                        <p class="text-lg leading-relaxed mb-6">
                            浮动可以帮助我们更好进行页面排版，使原本竖着排列的盒子可以横向排列起来。副作用：因为浮动会使元素脱离了标准的文档流，从而导致父级元素无法被撑开。解决办法：添加空盒子在被浮动的元素后面，添加一个空的div，并且设置一个clear类，并付给该div <code>.clear{clear:both;}</code>
                        </p>
                        
                        <div class="space-y-4">
                            <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                                <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787693164-71ca7bdc-e235-480b-a1c7-5f9cb6c11814.png" alt="浮动1" class="w-full rounded-lg">
                                <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787693413-0430fb9b-0095-420e-8720-aa08edef96a4.png" alt="浮动2" class="w-full rounded-lg">
                            </div>
                            <p class="text-gray-700">
                                但是都设置了浮动之后
                            </p>
                            <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                                <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787693647-f2c65339-7c79-42f7-b10b-a81e91d7e133.png" alt="浮动3" class="w-full rounded-lg">
                                <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787693894-b2f86966-2f5f-49f1-8af6-87764ba4b50e.png" alt="浮动4" class="w-full rounded-lg">
                            </div>
                            <p class="text-gray-700">
                                所以这个时候，是需要解决的
                            </p>
                            <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                                <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787694153-a19bb2bf-a8f1-4b6c-8165-9b5b529aaf3d.png" alt="浮动5" class="w-full rounded-lg">
                                <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787694382-a18c0c71-de35-4c9a-802d-9773363b7328.png" alt="浮动6" class="w-full rounded-lg">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Blog Homepage Section -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <div class="w-8 h-8 bg-indigo-600 rounded-full flex items-center justify-center text-white mr-4">
                            <i class="fas fa-home"></i>
                        </div>
                        <h2 class="text-2xl font-bold text-gray-800">制作博客首页</h2>
                    </div>
                    
                    <div class="flex justify-center">
                        <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1692787694646-7922e062-487b-4656-9653-36140ccf969b.png" alt="博客首页示例" class="max-w-full rounded-lg">
                    </div>
                </div>
            </div>
        </section>
    </div>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-8">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-semibold text-white mb-2">技术小馆</h3>
                    <p class="text-sm">探索技术之美，分享编程乐趣</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-300 hover:text-white transition duration-300">
                        <i class="fas fa-globe mr-2"></i>http://www.yuque.com/jtostring
                    </a>
                </div>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```